from django.http import HttpResponse
#
from django.shortcuts import render

def search_from(request):
    return render(request,'search_form.html')

def search_post(request):
    return render(request,'post.html')

#接收GET请求的参数
def search(request):
    request.encoding = 'utf-8'
    if 'q' in request.GET and request.GET['q']:
        message = '你的请求方式为GET,搜索的内容为：'+request.GET['q']
    elif request.POST:
        ctx = {}
        ctx['rlt'] = request.POST['q']
        message = '你的请求方式为POST,搜索的内容为：'+request.POST['q']
    else:
        message = '你提交了空表单'
    return HttpResponse(message)